<template>
  <div>
    <routerviss>
      <template v-slot="data">
        <input type="button" value="删除" @click="del(data)" />
      </template>
    </routerviss>
  </div>
</template>

<script setup lang="ts">
import routerviss from '../text02/adminShow.vue';

import { reactive, toRefs, onMounted } from 'vue';
import axios from 'axios';
import { useRouter, useRoute } from 'vue-router';
let router = useRouter();
let route = useRoute();
import { useStore } from '../../store/user';
let user = useStore();

const del = (data: any) => {
  if (confirm('确认删除吗')) {
    axios({
      url: 'http://localhost:64124/api/Text02/GetDel',
      method: 'get',
      params: {
        T_Id: data.data,
      },
    })
      .then((res) => {
        console.log(res);
        if (res.data.data > 0) {
          alert('删除成功');
          router.go(0);
        } else if (res.data.data == -10) {
          alert('有人投资删不了');
          return;
        }
      })
      .catch((err) => {
        console.log(err);
      });
  }
};
</script>

<style scoped></style>
